import pygame
from pygame.sprite import Sprite

class Bullet(Sprite):
	""" 子弹 """
	def __init__(self,screen,ship,settings):
		super(Bullet, self).__init__()
		self.screen = screen
		self.ship = ship

		self.rect = pygame.Rect(0,0,settings.bullet_width,settings.bullet_height)
		self.screen_rect = screen.get_rect()

		self.rect.centerx = ship.rect .centerx
		self.rect.top = ship.rect.top
		self.color = settings.bullet_color
		self.move_len = settings.bullet_move_speed


	def update(self):
		self.rect.y -= self.move_len

	def draw_bullet(self):
		pygame.draw.rect(self.screen,self.color,self.rect)